<template>
    <div>
        <ul>
            <li v-for='i in data' @click='setcid(i.id)' 
            :class="i.id==cid?'active':''">
                {{i.name}}</li>
        </ul>
    </div>
</template>
<script>
export default {
    data(){
        return{
            cid:0
        }
    },
    props:['data'],
    methods: {
        setcid(cid){
            this.cid=cid
            this.$emit('cid',cid)
        }
    },
    mounted() {
        
    },
}
</script>
<style lang="">
.active{
    background-color: aquamarine;
}
</style>